What is the correct syntax to add mailto to this ASP.NET MVC3 code. This doesn't work and neither does using double-quotes:
ModelState.AddModelError("", "We could not locate the email address you entered. Please check the email address. If you believe it is correct, please contact us by sending an email to <a href='mailto:support#abc.com'>Support</a> from the email address you are attempting to use.");
I am not that good at Razor but this can solve your problem for now
#Html.Raw(Html.ValidationSummary().ToString().Replace("[mailto]", "<a href='mailto:support#abc.com'>Support</a>"))
and your message will contain this
ModelState.AddModelError("", "We could not locate the email address you entered. Please
check the email address. If you believe it is correct, please contact us by sending an
email to [mailto] from the email address you are attempting to use.");
The link is now added in the view instead from the server/controller, replacing your [mailto] with actual link and calling Html.Raw to render the html in the browser
try to use
add this NamesPace :Using System.Text
StringBuilder s=new StringBuilder ();
s.Append(We could not locate the email address you entered. Please check the email address. If you believe it is correct, please contact us by sending an email to ");
s.Append("<a href='mailto:support#abc.com'>Support</a>");
s.Append("from the email address you are attempting to use.");
ModelState.AddModelError("", s.ToString());
Related
When I first created this Classic ASP script, with the help of W3Schools, to send email, it worked fine. Now I'm having issues with sending the actual email; it appears to hang on the .Send method.
I noticed that when I set the To and From email address to just the email address, it reformats it to a "Friendly Name"/Email Address format:
myMail.From="Support#myDomain.com"
Response.Write myMail.From
The output of the Response Write is:
"Support#myDomain.com" <Support#myDomain.com>
I don't know if this was happening before, or if I should be setting the To and From fields in this format. Just to check if this is causing my problem, is there anyway to prevent these fields from being changed from just the email address?
Maybe the e-mail sending from the server now needs some kind of authentication such as setting these fields:
' Outgoing SMTP server.
objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.mydomain.com"
objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDO.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' Type of authentication, 0=NONE, 1-Basic (Base64 encoded), and 2=NTLM.
objCDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
' UserID on the SMTP server
objCDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "support#mydomain.com"
' Password on the SMTP server
objCDO.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "myemailpassword"
' Update config.
objCDO.Configuration.Fields.Update
The issue stemmed from the fact that the "From" email address was actually a distribution list and the account credentials used to login to the email server were not authorized to "Send As". Once that was rectified emails sent without further problems.
Thanks for the response.
I use Contact Form 7 to send a messages.
In my own server theform works perfect. But client gets this error:
Failed to send your message. Please try later or contact the
administrator by another method.
in contact form setting in from field , insert a valid mail from your domain
this blog help you
I am getting 555 syntax error in mailfrom
SendData(tcpSocket, string.Format("MAIL From: {0}\r\n", MailFrom));
if (!CheckResponse(tcpSocket, 220))
{
tcpSocket.Close();
return false;
}
is it the problem in my local system because of localhost?
Please help me. I am using this code from below link.
http://www.codeproject.com/Articles/5189/End-to-end-Email-Address-Verification-for-Applicat
Please don't try to implement your own SMTP client, use the one that comes with .NET: System.Net.Mail.SmtpClient.
Many SMTP servers require TLS, for example, which your code does not account for.
Furthermore, for security reasons most mailservers will not reveal if an email address in an RCPT TO line is valid or not. If a system can positively reveal an address exists then it can be used by spam harvesters. Consequently using a dry-run of an SMTP client should only be used to validate an email address (because of the complicated rules regarding valid email addresses). The verification (a separate concept from validation) must be performed manually by requiring the user to respond to an email sent to that address, there is no other way to be sure.
SOLVED: Two students gave us the wrong emails, and for some reason the script refused to process more if it encountered a wrong email. I am still wondering why is it so !
I am trying to read a bunch of records from a database, and for each record I am creating some text based on some fields of the record and then sending them as email to the email address provided in the record.
The problem is the email gets sent for only about 5-10 records (it varies, once it sent 5 emails, with cc and everything, next day it sent 7).
After this it comes up with the famous error:
error '8004020f'
/sendEmail.asp, line 139
I have researched all around the internet, and I see many have issues with this error, but not the kind that I am having, in which few emails are send and then it stops.
Also, all emails are being sent to the same domain, the official school email of the students.
Any ideas? Any settings that I might want to ask the website hosting guy to change?
Here is the code.
Dim objMail
Set objMail = CreateObject("CDO.Message")
objMail.From= "someEmail"
objMail.To=rstemp("Email")
objMail.Cc = "someEmail"
objMail.Subject = subjecttext
objMail.HTMLBody=tempData
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")= 2
'Name or IP of remote SMTP server
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.*"
'Server port
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
objMail.Configuration.Fields.Update
objMail.Send
set objMail=nothing
tempData = nothing
EDIT: On more debugging, it turns out that when I replace the objMail.To from sending it to each student's email to my own email. It works fine and sends all the emails to me.
Please check first all the Emails is valid and no test email is there. and you can test it with send all emails on same email address for no. of time and can track the problem that is this Email address problem or something else.
On the following page http://documentation.magnolia-cms.com/modules/mail.html#ConfiguringSMTP
In the section "Sending messages >> Plain text and HTML messages", we can read:
From:[...]Regardless of the address entered here, Magnolia CMS will use the smtpUser to send the email but the address here is displayed as the sender to the recipient. This means you can send an email from fake#address.com and it will appear to come from this address
However, when I receive the email I can still see the smtpUser config's email and my "fake#address.com" email address is not displayed (it is ignored!?)
Am I missing something? Thanks
I just tried this on the demo site at http://demoauthor.magnolia-cms.com/demo-project/service/contact.html and it seemed to work as expected.
Are you using a fresh install of Magnolia 4.4.5? Could you verify that you're hitting the "Edit Form Settings" button on the page, going to the "E-Mail" tab, and entering "fake#address.com" into the From field there? If you're then trying the form on a public instance, you'll need to be sure that the form page has been activated so that the public version of it has your "From" setting as well.