Didn't find the exact answer for my question. The problem is, the code sends an email (user to user), so I did a $headers for a reply-to with the email entered by the user. In this $headers, I put the "From" email as the email of our website. However, the email does not get sent. It does send appropriately when I put a Gmail or Hotmail in the "from" position. So the problem appears to be our website email. Should I talk to my host or could there be something else? Just ask if there needs to be more details.
Yes, you have to talk with your host for your website email address is working or not.
Please check mail in spam when send using you website email address
Related
I'm using the $email->setFrom('no-reply#example.com'); method and it's working fine for email delivered to the registered sender.
However, the email is delivered as no-reply#example.com.
How can I include the email of the customer that has filled the form? Eh: mario#gmail.com?
If I replace $email->setFrom('mario#gmail.com'); I will get 403.
This happen because I have to register the sender. But I just need to create a simple contact form.
Is there a way to use setFrom using a custom email?
Thanks in advance
Twilio SendGrid developer evangelist here.
When sending emails with SendGrid you do need to verify the email or domain you are sending from. So, you can't use any email address as the from email.
You're creating a contact form, which is why you want the email to appear to come from the person sending it. However, what you really want from that is to be able to reply straight to the person that sent the email.
What you can do is send the email from a domain or email address you have verified and then set the reply-to header to the user's email address. You will receive the email from your chosen email address but when you go to reply the to address will be filled in with the custom email address.
$email->setReplyTo("mario#gmail.com");
I want users on my website to use php mail() to send emails from my website domain. I would like users to get replies on their personal email address which will not be my domain email it might be gmail, hotmail or any other. When I do so, the email recipients get a phishing warning in gmail.
How can I set headers in php mail() so different sender and reply-to emails do not make gmail and other services tag the email as spam or phishing.
Your recipients are getting a pishing warning because your emails are not passing SPF checks. That simply means that the from domain you are using is not authorizing your server to send mail on its behalf.
Try using PHPmailer https://github.com/PHPMailer/PHPMailer
You can use it to set a separate from address as well as a specific reply to address
$mail->AddReplyTo('replyto#email.com', 'Reply to name');
$mail->SetFrom('mailbox#email.com', 'Mailbox name');
That being said. The SetFrom address is an address that must pass SPF and preferably DKIM checks to be NOT marked as SPAM or PISHED. This address is recognized as the BOUNCE address where all the bounced emails will be returned to. Not having a valid address may possibly disrupt future deliveries.
The AddReplyTo address will be loaded when the reply button is clicked by the recipient. Keep in mind that even though the message may pass SPF there are many SPAM filters that will potentially mark the message as spam.
The easiest way to get this working is to create an email address on your website (me#mysite.com) then get the website to automatically forward all mail to your gmail account. Then, use the website email address in the 'From' and 'Reply-To' address of your mail() routine.
I've built a contact form in which a sites visitor enters a message, subject and his own email address. The email then is sent to a fixed gmail address.
I'd like the receiver of the mail to be able to just click on answering in order to respond. Therefore I set the senders email to that one entered by the sites visitor.
Problem is, gmail considers those mails as spam. I guess because the DNS of the senders address does not fit to the servers IP.
So I wonder if there is a strategy to achieve what I have described.
There are other email addresses you can add that will probably fix your problem. I suggest that you give your email From, Sender and Reply-To addresses:
From: visitor's email
Sender: your email
Reply-To: visitor's email
Reply-To is the address any reply will go to. Sender means that the email coming from you makes sense. From indicates that you are sending it on behalf of the visitor.
I am working with the mail function in PHP.
It has an optional parameter "From" where you can input an address and the recipient of the email will see that the mail was sent from that email address.
This PHP function works fine when sending to my AOL email account, but when I tried to send it to my cell phone number (cell number)#vtext.com, the message is delivered, but the sender's address shows up as (myusername)#box489.bluehost.com, instead of the "From" parameter(myaddress#mydomain.com).
However, when I send a message to my phone through the online webmail app manually the sender address shows up correct(myaddress#mydomain.com).
Can anyone help me out with this?
It needs to come from a real address. Telcos use a service like senderbase.com from cisco, when they receive the message they are going to check reputation, spf records, rdns and possibly more. I created a sms system some time ago and i ended up using the PEAR mail package to authenticate with an email address on my mail server through smtp then send the message... also even tho you may be sending the message from a real email, the mail() function will send from the IP of the webserver not mail server, which they will also check against.
such an annoying problem, isn't it? here's a solution i came across finally :)
--
$headers = 'From: noreply#domain.com';
mail($to, $subject, $message, $headers, '-fnoreply#domain.com');
this mail will show up as coming from noreply#domain.com, it's the thing after the -f flag which makes that change.
this fifth parameter of the mail function fixes things quite nicely. Let me know if it works for you as well. Now if only you can get it to go from a consistent number each time, that would be really helpful.
My webhost ONLY allows sending/recieving emails IF either the sender or reciever is hosted with them. (freehostia.com)
This is a huge disadvantage to me (and I'm assuming everyone else), because of the way my website works.
(My website: I have a classifieds website where CustomerA posts an ad with her email and CustomerB replies via the email form with his email. Neither email is hosted with my host.)
I asked if I could use an external SMTP server (such as Gmail) to bypass the limitations, and they said "Even if you set an external MX record for your domain you will not be able to send e-mails via your mail forum, if you do not use a mailbox from your hosting account with us as a sender or recipient."
Theoretical Workaround:
Auto-enter and hide my hosted email into the "email" section of the form
Have a new section for customer to input their email
When a message is sent, embed customers message and email into a default message. It will look like this:
To: customerA#example.com
From: DONOTREPLY#example.com
Subject: You have recieved a message!
Body: Blahblahblah (customers message) blahblah. To reply, email: customerB#example.com
Sorry about all the confusion. Would this work? Should I give up? I really like my host, but should I switch? Or is there a better workaround?
While you don't need to send through a different server, you can just send to whom you need and set the reply to any address you want.
The mail function allows you to set your own headers as a final parameter.
$headers = 'Reply-To: someone#some_other_domain.com\n\r';
mail($to, $subject, $body, $headers);
You can set the reply-to address.
That way even though the email is sent from your address, when the recipient hits reply it creates an email to the address given in the reply-to.
I'm not sure what you are using to send mail but there are some examples in the PHP documentation mail function - http://php.net/manual/en/function.mail.php