I am developin a web site based in wordpress and we have Easy SMTP plugin configured with an SMTP account.
In adiction, I'm coding a plugin to this site. I need all emails been sended from one account, except the emails sended by my plugin.
Theese emails must have another sender (other smtp account). Both SMTP accounts will be in the same SMTP server.
Is this possible? Can I pass some header to wp_mail function to change the SMTP authentication account for a specific email send?
I don't see any documentation that helps me...
Thanks.
edit:
I know that I can do something like:
$cabeceras .= 'From: Recordatorio <cumples#example.com>' . "\r\n";
But i'm not sure that if this is a good method or if is recomendable doing it.
Related
I'm configuring Moodle for a school project and there is a problem in email confirmation process.
following are my configurations:
outgoing mail confirmations
SMTP hosts: stmp.gmail.com:465
STMP security:TLS
STMP Auth Type:LOGIN
SMTP username:****#gmail.com [*admin e-mail*]
SMTP password:****
SMTP session limit:1
no-reply domain
no-reply address:***#gmail.com [*admin e-mail*]
Allowed email domains :
Email display settings
Character set : UTF-8
Allow user to select character set :no
Allow attachments: yes
Email via information: always
when user signed up; admin gets a notification that new user required access but the new user wont get any confirmation email.[before and after confirmation from site admin]
no email can be found in spam or inbox.
please help!!!
For the outgoing mail configuration you should just leave all the settings blank or revert them to their defaults. Unless you have a dedicated SMTP server (i.e. one that is hosted within your organisation and is specifically configured to relay outgoing mail from your Moodle server) then you should just let Moodle use PHP's own mail libraries to send mail.
Hope this helps.
I want to send mail to inbox using smtp mail method using PHP.Now mail go to spam instead of inbox,i am using smtp mail method.I had set the hostname,username and password.
<?php
define("SMTP_HOST", "mail.test.us"); //Hostname of the mail server
define("SMTP_PORT", "25"); //Port of the SMTP like to be 25, 80, 465 or 587
define("SMTP_UNAME", "tttt");
//Username for SMTP authentication any valid email created in your domain
define("SMTP_PWORD", "tttt"); //Password for SMTP authentication
?>
Mail code
//smtp mail
$mail = new PHPMailer;
$mail->Host = SMTP_HOST;
$mail->Port = SMTP_PORT;
$mail->SMTPAuth = true;
$mail->Username = SMTP_UNAME;
$mail->Password = SMTP_PWORD;
$mail->AddReplyTo("test#test.com", "zamisoft");
$mail->SetFrom("test#test.com", "zamisoft.com");
$mail->Subject = $subject;
$mail->AddAddress($to, '');
$mail->MsgHTML($message);
$send = $mail->Send();
$mail->ClearAddresses();
//smtp mail
Anybody give any solution for these issue?
Add Headers to your email
$headers='From: ann#zamisoft.com \r\n';
$headers.='Reply-To: ann#zamisoft.com\r\n';
$headers.='X-Mailer: PHP/' . phpversion().'\r\n';
$headers.= 'MIME-Version: 1.0' . "\r\n";
$headers.= 'Content-type: text/html; charset=iso-8859-1 \r\n';
$headers.= "BCC: to";
It's been a while since I've played with PHP mail, but if that doesn't work it should put you on the right track.
Make sure you have SPF and DKIM setup. Since you are mailing from your own server, this is highly recommended.
Here is a link to Namecheap with screenshots. I couldn't explain it better:
https://www.namecheap.com/support/knowledgebase/article.aspx/9214/31/email-authentication-tool-in-cpanel-spf-records
Also, there are various checkers out there that well validate your SPF, DKIM, and check other things, and give it a score.
http://www.port25.com/support/authentication-center/email-verification/
https://www.mail-tester.com
http://dkimvalidator.com
The only things you can do when mailing from your own server. Use SPF and DKIM. Stay away from spammy words. One wrong word can make the difference of spam or inbox. Have a baseline email and baseline subject for testing. I had a slogan of mine that landed me in the spam folder, so I had to change it because I wanted it in the signature of my emails. Using certain link shorteners could land you in the spam folder. I am not saying they do, but using bit.ly or tinyurl links could land you there. Using tinypic or another image hosting service could. Your domain name could be the problem! The from name..
Remember, every word (whether it's in your email address, domain name, hostname, subject, or the body of the email) is looked at.
As well as your server's IP address. Is it on any blacklists? Check it with http://mxtoolbox.com/blacklists.aspx
Without one of us actually getting on your server and sending dozens of test email to see what is actually causing it, I can only tell you the dozens of things to check.
With all that said, mailing off your server sucks and I don't recommend it. I suggest using SendGrid or Mailgun. I had a client landing in the spam folder, on a new server, clean IP, new domain, everything. I put him on SendGrid and he wasn instantly going into the inbox.
For development, or a low level site, mailing off your server is fine if your hitting the inbox most of the time. But anyone that takes their site serious and the emails hitting the inbox is important, use a 3rd party. Most servers (from GoDaddy, Hostgator, etc.) are not for sending emails to tens of thousands of customers. They are web servers, not mailing (MX) servers, and they will tell you that it isn't their problem.
Update: I forgot to mention reverse DNS. You should have rDNS setup, and that is done by your upstream. So you would need to contact your webhost and ask them to setup "Reverse DNS" on your server.
Can you show the content of your mail? Are you trying to send HTML or text mail? Maybe the provider is on blacklist, check the sending IP address (see mail header) at a blacklist check.
I had these spam problems with Google Mail only when sending with mail() - after the change to SMTP all works properly.
I am using swift mailer to send emails and imap_append function to copy the the message in sent folder. The IMAP folder settings work properly with Yahoo and Hotmail accounts.
When mails are sent using a Gmail account SMTP and IMAP configuration, two copies are stored in the sender's "Sent" folder.
This is the IMAP code I am using:
$imapHostString = $mailSettings['imapServer'];
$imapHostString .= ($mailSettings['imapServerPort'] == 143)
? ":143"
: ":{$mailSettings['imapServerPort']}/imap/ssl/novalidate-cert";
$mbox = imap_open('{' . $imapHostString . '}INBOX', $mailSettings['username'], $password);
imap_append($mbox, '{' . $imapHostString . '}' . $mailSettings['sentDirectoryName'], $message->toString() . "\r\n");
imap_close($mbox);
Why this is happening?
Are there any gmail settings to be done?
This happens because Gmail automatically copies messages sent through its SMTP server into the sender's "Sent mail" folder, while Yahoo and Hotmail don't and thus require you to copy the message manually.
Other than trying to detect when the SMTP server is a Google one, I'm not aware of any way to detect this situation. It would be nice if the SMTP server would tell you that it was going to do this, for example.
I asked a similar question earlier, but the context has changed a bit. I want to use swiftmailer to send an email in Symfony 2. The problem is I'm using the gmail SMTP server, and so when my message arrives, my email client shows it from gmail.com, rather than mydomain.com. How can I fix this?
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom(array('digest#mydomain.com' => "Digest"))
->setSender(array('digest#mydomain.com' => "Digest"))
->setCharset('iso-8859-1')
->setContentType('text/html')
->setTo('myemail#gmail.com')
->setBody($this->renderView('email.html.twig', array()));
$this->get('mailer')->send($message);
The Gmail SMTP server only allows you to send mail using the email address you're aithenticating with. So if you configured Symfony with
mailer_transport: gmail
mailer_user: myemail#gmail.com
mailer_password: ******
All your messages we'll look like they're from myemail#gmail.com
What you can do maybe is use another smtp server that is more flexible in the types of From addresses they will allow. If you are on a local development server, you could use your ISP's SMTP server, or use one of the various email as a service provider, such as Sendgrid, Mailjet or postmarkapp
They all allow you to send messages from any address you can prove ownership of, after some configuration steps.
One thing that may be worth trying also if you really want to use the gmail smtp server, is to define your from address in your "Send mail as" Gmail configuration (in Settings -> Accounts). This will let your app send email using the configured adresses in the From: field.
Is there any way to send mail from a gmail account to someone? And by "from" i mean so that it stores the email in the gmail inbox aswell...?
I've tried using imap, but i'm not sure if that's the correct way? Either way i get this error:
Warning: imap_mail() [function.imap-mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\gmail\index.php on line 12
Any idas how to achieve this?
Thanks!
Try using smtp instead, Gmail will put your email in sent folder for you. All the instructions are provided in the settings page of your gmail account.
http://deepakssn.blogspot.com/2006/06/gmail-php-send-email-using-php-with.html
You could do the same thing email clients do: Send your mail through SMTP and then create a mail in the Sent folder through IMAP.