Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php mail() from godaddy server

Tags:

php

email

I'm using godaddy for hosting my site and using default godaddy mail service. Now i want to sent email using php mail function to other email address from my 1 of my 15 email address of my godaddy's email accounts

How can i fix that from which email address email will be sent and how to place the username and password for the email address ?

Thanks

like image 964
fean Avatar asked Jun 18 '11 11:06

fean


People also ask

What is the mail () function in PHP?

PHP Mail Introduction The mail() function allows you to send emails directly from a script.

How can I get mail in PHP?

It's possible to receive email in PHP by running a mail server and executing a PHP script with the email passed to STDIN. With CloudMailin you don't need to do any of that, your email is delivered to your application over HTTP(S).

What mail server does PHP mail use?

PHP mailer uses Simple Mail Transmission Protocol (SMTP) to send mail. On a hosted server, the SMTP settings would have already been set. The SMTP mail settings can be configured from “php. ini” file in the PHP installation folder.


2 Answers

The PHP mail function uses the mailserver configured for that webhost. You can't change that. Since godaddy controls the mailserver they control what headers it sends. You could try inserting a custom From header but I doubt that will work. It will either get modified, flagged as spam, or rejected.

If you have 15 accounts at godaddy, perhaps it's time to look for a more serious hosting solution?

like image 74
Halcyon Avatar answered Sep 27 '22 11:09

Halcyon


Instead of using the mail() function, which just calls the OS mail function (i.e. sendmail), try something like SwiftMail (free PHP mail library). It support many different ways of sending mail, including logging into a mail account and sending email, just like you would do from your own computer. You could even send email from a gmail account if you wanted.

http://swiftmailer.org/

like image 29
Brent Baisley Avatar answered Sep 27 '22 11:09

Brent Baisley