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.
Related
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.
I've tried using Postfix only as a SMTP server for sending "verification" mails locally, to any provided destination. The current problem is, it sends all mails without any issues but receivers don't get them.
I'm using XenForo software with "127.0.0.1:25" SMTP data for sending mails, without user - / pass login because Postfix is locally bound and should only send mails - not receiving any from outside.
Also I'm using my custom domain to provide "from:" data for mail. (e.g. "no-reply#*******.com")
I already tried using SMTP servers of different hosts such as "MailJet" but I had the same issue there. The staff of used hosts said, there'd be something wrong with my server and nothing else, so that's why I had decided to host an own SMTP server locally on the same server as like as my webserver's running.
Postfix "main.cf" file: http://pastebin.com/r8EfKbXL
Logs: http://pastebin.com/TnjVbNfp
Thanks in advance.
Sincerely,
Chris
And you have SPF, DKIM, etc. all sorted? I suggest you (authenticate with and) use the same SMTP server you use for all other email from that domain, create a separate inbox if you need so it's using different credentials to you. It's usually a lot less hassle.
Should there be a record of all php sent mail (via our hosts mail() function) anywhere?
Our web developer made an oversight and all enquiries sent via the our host's (godaddy.com) mailer relay for the last 2 months were rejected by our local mail server. Naturally, our server doesn't keep any rejected emails.
I have spoken to godaddy.com and they claim there is no record, however I'm not particularly confident with the answer.
Is there anything I can do? The enquiry form is now fixed (used Mandrill), so that's not an issue.
No, the mails are gone now.
Rejected mails that a mail server tried to send usually go to the mail admin account of the sending server as a bounce - however, even that account might not be set up or failing or rejecting mail, so the mail server will get rid of these undeliverable mails that double-bounced by deleting them from the queue.
You might get an idea of what was tried to mail if you are able to get your hand onto a mail server logfile, but assuming this is in the hands of your hosting provider, your chances are low: 1. these logs would only give you an idea of which mail addresses were involved, but no content. 2. the log files usually get deleted quickly because they'd serve no regular purpose.
I'm created a website with PHP on a Linux web hosting package. Normally I will get emails sent by its contact form that produced by PHP Mail() function. But this time, it is a strange case for me.
My customer company has a mail server. If I send an email via my personal email on Gmail, they will get it on their mail server. But when I send emails via contact form, emails go to webmail on website hosting package.
I've removed all email accounts on this host, also I removed DNS MX record from it, but still I can not receive emails sent by contact form on the company mail server accounts.
How can I solve this problem?
As it seems from your question the webshoting provider is also your email hosting provider. The way you explained the problem leads me to the conclusion that your PHP script uses the mail() function which will internally call the MTA (like sendmail) to send the email.
Now what seems to happen here is that PHP is sending the mail through mail() function which is passing it on to the local MTA (like sendmail) which is checking the local configuration. In the local config it seems to find the recipient domain as a local domain and deliver the mail locally to the user. In this case the email is not even leaving the webhoster's server.
As this is not what you expect, you have 2 possibilities if you do not have influence to the MTA's configuration (what i think you dont have).
I would propose (if possible) to not use the mail() function. There are ready to use SMTP classes which will connect to a SMTP server of your coice to send the email to. In that way you can avoid this problem. You should find something in the PHP Classes Repository.
Send the email to a different domain if possible. That way the MTA has to check DNS and send the email to another SMTP server for delivery.
The first thing to establish is how you are sending emails (sendmail or SMTP). Then, whether your emails are a) not sent at all or b) getting rejected by the destination mail server.
I'd check all available logs (source and destination mail servers and daemons). See if mail() itself is erroring. Try using sendmail/smtp directly.
If its the destination server rejecting the mail based on its spam score, try setting SPF records to enable the web server to send mail legally.
If your email function "mail($to,$subject,$message)" is not working then you need to check the server configuration. Now it is enable or not .
For more details, see here : https://wycks.wordpress.com/2013/10/09/when-phps-mail-function-doesnt-work/
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.