Authentication in email forwarding between SMTP servers - php

I am writing a Mail Relay Server in PHP for Newsletter mailings.
This server encodes all links in the e-mails so that they point to an accompanying website for tracking (click count only) and redirecting.
This Mail Relay Server will run as a service for multiple customers sending Newsletters.
Each customer has it's own credentials for the Mail Relay Server.
The newsletters may go to a great amount of recipients.
As of this, I can't forward all mails through my own mail account (would bring my webhoster on the blacklist).
This is why I thought of forwarding them to the recipients' mail server myself, using the techniques used in e-mail forwarding all around the world.
My question now is: Is there a way to forward e-mails from an own SMTP server to another, for which I don't have a mail account and cannot send credentials?
Thanks in advance for any help and clarification on this.

Related

WordPress on VPS running Plesk, no mail is being sent out

I have a VPS server running PLESK(12.5.30) and all of the WordPress forms we have that are supposed to send to people who fill out forms, are not being sent. They are just sitting in the mail queue as 'deferred'.
I think it has to do with php mail, but I can't seem to get this to work and my host is literally no help at all. I even called Plesk and they did not help.
Any ideas?
Thanks!
For more information you can check system mail log somewhere in in /var/logs/
Take in account that setting up working server of outbound mail is a real pain. In two words you need to setup SPF and DKIM or such mail services like Gmail will mark all emails from your server as spam by default.
In your case I can suggest to SendGrid service which has a WordPress plug-in https://wordpress.org/plugins/sendgrid-email-delivery-simplified/
(You need to register SendGrid account, it's free)
If your contact forms using default wp_mail() you mail will be send through SendGrid mail servers.
Also you can setup you Postfix/sendmail with using SendGrid's mail server: https://sendgrid.com/docs/Integrate/Mail_Servers/postfix.html

Using PHP to send mails from my organisation's email id?

So, I developed this web application which needs me to send emails to everyone (details in a mysql database), providing a unique set of user credentials. I have a virtual server on the University network where I am hosting my PHP based application, so it obviously doesn't have its own mail server/SMTP settings.
So, if I were to send out mails from a university network, I guess I should request the network admin for the SMTP settings for the university mail network and then use PEAR for it right?
I need to confirm this because it's kind of a big deal to make a request like that, and I myself have never used PHP to send mails 'from' an external email id not linked to the server.
Are there any alternatives to this?
Yes you can use PEAR::mail to send mails via SMTP server. However, if SMTP is configured on localhost you can simply use mail() function to send mail. You can also connect to SMTP server via socket but then you need to handle whole protocol communication.

Gmail and PHP MAIL function

I have a small problem that i cannot for the life of me seem to solve. I have a php script which takes some user data and processes it and sends an email to admin and an email to the user with an activation key. This is all fine and dandy, but the problem is GMAIL accounts. The user gets the email no problem but if it is a GMAIL account there is no mail in the inbox or spam box. Just wondering anyone might have any solutions.
moved from my comment:
so across the board, NO gmail accounts get your email? Maybe your host is blacklisted, and your mail is just flat out banned? Is your server blacklisted? Have you checked? Also what is your /var/log/ mail queue result? Does gmail accept the mail?
Some tools, check if you were blacklisted here:
http://www.mxtoolbox.com/blacklists.aspx
http://whatismyipaddress.com/blacklist-check
Some more info on getting un-blacklisted: http://www.isipp.com/resources/am-i-blacklisted/
Be aware that sometimes it may take awhile to get de-listed, I had one
server act up, and was blocked by hotmail, for a few months even after
all places removed my ip.
Consider using some SMTP php implementation, which can reveal possible problem.It will contact gmail servers directly without passing them to MTA.
Also note that gmail uses SSL enalbed SMTP servers on port 465 or 587.
On other way, take a look at this : http://www.richardlord.net/blog/php-mail-and-gmail

handling bounce email w/phpmailer

I have a webpage that sends out emails using phpmailer. I set the host to 'relay-hosting.secureserver.net' the mail->sender, mail->from and mail->addReplyTo all to the same address, which is the address that I want the bounced email notifications sent to. This email address in also with the same host and the smtp host. When I put in a bad email address I don't get a notification that is was not delivered. What am I doing wrong? Thanks
PHPmailer does not handle receiving emails. It's purely a library for allowing PHP to talk to an SMTP server for sending emails. It has absolutely no support whatsoever to act as a mail client (e.g. receiving).
PHPmailer has no way of knowing the email bounced, as the bounce occurs LONG after PHPmailer's handed the email off to the outgoing SMTP server. IN real world terms, PHPmailer takes your letter and walks down the block to drop it into a mailbox. The bounce occurs later, when the letter carrier brings the letter back with 'return to sender' stamped on it - PHPmailer is not involved in this at all.
Your options are:
1) Use PHP's imap functions to connect to an existing pop/imap server and retrieve emails that way
2) Use a .forward or similar redirect on the SMTP side to "send" incoming email to a PHP script.
I know this is an old and answered question, but for those who may find this post later with a similar problem you might be able to solve this by going to your smtp mail relay service. If for example you use jangosmtp there is an option in your jangosmtp control panel to either hard code the address to which bounce reports should be sent or to always send bounce reports to the From address.

PHP PEAR Mail: Relay access denied

I can send emails to myself and other people on my mail server using PEAR Mail. But when I try to send to another server, I get an error:
Relay access denied.
I've checked the SMTP configs and they're exactly the same as in my email client.
What could it be?
Relay access denied.
A "relay" is a mail server that acts as an open gateway, allowing anyone to connect to it and send mail through it ... to anyone. If the target isn't local, a relay will make a best effort to pass it on.
Obviously this is a tremendously bad idea.
Chances are that the mail server you are using is either locked down to local delivery only, or it wants you to authenticate first to prove that you are permitted to send mail through it.
You will need to contact your sysadmin to ask him or her about the error, and exactly what you need to do in order to send mail through it.
Is your email client authenticating to your SMTP server? Most servers will allow authorized/authenticated users to relay mail through them. That way you can be (say) a salesman in a hotel room somewhere and still send mail to a 3rd party via your corporate mail server.
Check that your PHP mail call is using the proper SMTP credentials (which means username/password, not just the server address). Since your email client can relay, but your script can't, most likely the script isn't authenticating.

Categories