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");
Related
I have to search all email sent and from a specific email address with php.
In some emails the email are from different sites and the address is in the reply-to header.
In the sent folder is simple, I'm using the imap_search funcion:
$imapResult= imap_search($imapStream,'TO info#email.com');
Retrieve the message from a specific email address is also simple:
$imapResult= imap_search($imapStream,'FROM info#email.com');
The problem is to retrieve the message from an address via other webservices, having from header the email of another site, and the email of the client in the reply-to header.
A solution is parse the header of all emails in inbox but it will be too slowly.
What is the faster method to search the inbox email with php to retrieve the messages from a email in reply-to header?
I solved the problem using the text option
$imapResult= imap_search($imapStream,'TEXT "info#email.com"');
Now I find in the inbox all the emails from the client.
It's impossible another client send me an email with inside the text the email address of onother people....
I'm using Codeigniter PHP Mailer which is hosted here: https://github.com/ivantcholakov/codeigniter-phpmailer/ and with gmail smtp it works flawless.
However,using it for a standard contact form, when visitors use that contact form and send us an email, they basically send mails from our mail address to our another mail addess. When they open their own email address, they wont be seeing what they sent in their own sent items. What I want to do is (maybe without using smtp settings) show the visitors own mail adress (the one I'm asking as an input on contact form) as the FROM part of the email I receive from my contact form. So that, in case I want to reply the mail, hitting the reply button would be enough. İnstead of doing coding tricks and showing their email somewhere I could copy/paste and send new email.
Don't do that. It's effectively forging the from address and will fail SPF checks. Instead, use your own address as the From address, and add the submitted address as a reply-to address. In PHPMailer:
$mail->From = 'youraddress#example.com';
$mail->addReplyTo($POST['emailfrom']);
Actually, I want to add the email address automatically join on my google groups by emailing on mygroupname+subscribe#googlegroups.com. But the issue is, when i email from php code to my group email for add. The google first send the reconfirm email to the user email and if direct email from hotmail,yahoo or gmail then google directly add the person as a member.
My Question is: Is this any php email code which works like the second scenerio i.e. add the person directly on group. I used PHP Mailer gmail smtp also but on that case, it adds the smtp user email not the email address which i set on From ? Please help me out.
Thanks in advance!
No, this is on Google's side, not php's Google must confirm the user wants to be added, and confirm the email address is valid.
I am trying to build a email messaging system for a classified site ( a la craigslist), so that users can email each other. emails of registered users are stored in a database.
What I want is for the recipients email address to be hidden from the sender's . If I just use the mail() function and dynamically get the recipients email from the database, will this email be visible to the person sending the mail ??
if the recipients email is indeed hidden from the sender's when using mail() this way, then why does craigslist anonymize's email ? isn't it already anonymous ?
Edit: so the email won't be visible to the person filling the form. SO the question remains is why does craigslist anonymizes email addresses? and whether I should implement the same ?
Craigslist doesn't use a form to submit. They provide an email address. When the users send the email using their own email system to #craigslist.org, then their servers get that email, look up the appropriate record, and forward the email to the real email address, so the sender never sees the real email address of the person.
If you're providing a form for the users to fill out, then you're doing something completely different from craigslist. You don't have to show the person's real email address on the form, and they're using your form, not their own email program, to do the reply, so there's no need to show any email address at all, anonymous or real.
If you're going to let people use their own email programs and provide them with an email address, then use the anonymizing service, which will add some load to your servers since they'll have to parse and process incoming emails at a variety of addresses. If you're using a form, you don't have to show any email addresses at all.
You are the one sending it, and it really comes from your server, not the person who filled out the form on your website. So no, there is absolutely no way they can see the real address it went to.
Why does craigslist take it a step further? Not sure, but its not for that reason.
I'm using AuthSMTP which is a paid SMTP Relay service. They only support a finite amount of "from" email addresses, which must be proper accounts.
This is my first site build and I'm trying to get my head around how to implement email.
When a user registers with the site or forgets their password, I have an 'info' email account which these messages come from. This works.
However, how do I go about the contact form? I want the email to come from the user who filled in the contact box TO the info inbox. I need to be able to reply directly to them.
How can I do this is my server won't allow the email to come "from" the user? if I use the "reply-to" in the headers, what do I put for the "from" field?
put the email address you are logging in with