mail from one mail server to other mail server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

mail from one mail server to other mail server

Post by softsolvers »

Hello friends
I want to send mail from from one mail server to other:
for example
from aaa@yahoo.com to aaa@rediffmail.com.
if i am using the default setting of php.ini and write the mail function i am not able to do this can anybody helps me that how can i do this.
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

What is the code that you are using?
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

Post by softsolvers »

thanks
i am using the simple code

<?php
mail("aaa@rediffmail.com","testing","test");
?>
and in php.ini file i had changed the sendmail_from :aaa@yahoo.com and rest settings are default
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

I just tosed this together It should work but I havn't tested it..

Code: Select all

<?
$mailto = "aaa@rediffmail.com"; //email you are sending to
$email ="aaa@yahoo.com"; //From email
$message = "Test"; //message body
$subject = "Testing"; //Subject line
$msg = ereg_replace("\\''", "'", $message);
$msg = ereg_replace('"', """, $msg);
$message1 = "From: $name\nemail: $email\nmessage:\n$msg1";
mail($mailto, $subject, $msg, "From: $email\r\nReply-to: $email\r\n");
?>
on your code you didn't add "From: $email\r\nReply-to: $email\r\n" that to it so you could also do it this way

Code: Select all

<?
mail("aaa@rediffmail.com", "testing", "test", "From: aaa@rediffmail.com\r\nReply-to: aaa@rediffmail.com\r\n");
?>
Post Reply