Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
GOT the answer from GoDaddy. The code is correct. Cox mail was rejecting the emails coming from Godaddy servers.


We are not getting our emails from the contact form on our website. The email address had changed and I am trying to make sure it was done properly. Though I am not a programmer and I can follow the code. I see the oMail.To= is sending the email TO the correct address. My question concerns the oMail.From= statement. what is supposed to be in that field. I have read that it is supposed to be your email address or domain name. If so, does it need to be different than the one listed in the oMain.To= line?

This is a website hosted on GoDaddy but email is stored at cox business mail.

C#
oMail = New System.Web.Mail.MailMessage()
            oMail.From = "webmail@Mybusiness.com"    THIS IS IN QUESTION
            oMail.To = "office@Mybusiness.com"
            oMail.Subject = "Mybusiness Web Request!!!!"
            oMail.BodyFormat = MailFormat.Html
            oMail.Priority = MailPriority.High
            oMail.Body = mybody
            SmtpMail.SmtpServer = server
            SmtpMail.Send(oMail)


What I have tried:

I tried using the same email address in both locations and I tried using 2 different email address in the locations (both mine). Neither worked.
Posted
Updated 11-May-16 8:41am
v4
Comments
Sergey Alexandrovich Kryukov 11-May-16 11:29am    
Are you serious? "From" is address of the sender (e-mail address, that's it), "To" is the address of the one you are sending to. How else it could be possibly understood?
—SA
Member 12517425 11-May-16 13:47pm    
You are mistaken. In this instance oMail.From is your domain email so that the server will recognize that it is a valid email. I got this straight from GoDaddy. You could actually put a fictitious email address in that field, as long as it has your domain name.com and it would work. It was confusing and that is why I was asking. I spent a couple of hours on the phone with Godaddy and messages are now going thru as I re-routed them thru a gmail server and then on to cox mail.
Sergey Alexandrovich Kryukov 11-May-16 19:38pm    
This header is important because the addressee is supposed to know who sent the mail. I don't care what goDaddy told you, I say how it should be.
—SA
Member 12517425 31-May-16 19:47pm    
Dear SA
Thanks for the input. I would like to see the code to support your assertion. How to have the From address pickup the email address from the input field and be allowed out of the server. Please show me. ( ͡° ͜ʖ ͡°)
Sergey Alexandrovich Kryukov 31-May-16 21:28pm    
Excuse me, what assertion, exactly?
(Nice emoticon, by the way)
—SA

1 solution

No solution required. Code is correct. The "from" can be any email address within your domain. This lets the hosting server know that it is a legitimate email address and it is OK to SEND. It then shows up in your email inbox (oMail.To) with the oMail.From address as the sender (your website).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900