Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

how to send email without using any module?

by hweefarn (Acolyte)
on Dec 21, 2003 at 12:05 UTC ( [id://316172] : perlquestion . print w/replies, xml ) Need Help??

hweefarn has asked for the wisdom of the Perl Monks concerning the following question:

hi :)

recently i have been testing a lot of ways to send email using perl. obviously most of the solution use certain perl module such as IO::Socket::INET, Net::SMTP or others. the email can be sent out successfully, but it doesnt suit my need.

actually i need to send the email as an email-to-sms service. i need to send email to the service provider, such as 0123456789@sms.maxis.net.my. everytime when i use the solution as mentioned above to send email, the email can reach my webmail account successfully, but it cannot reach my cell phone. so i start searching what is the reason. then, i found out that there were some additional hearders/information that was attached to the email i send. for example like this:

****************************************************
X-Apparently-To: hweefarn@yahoo.com via 216.136.130.94; Sun, 21 Dec 2 +003 03:35:58 -0800 Return-Path: <chfarn@tm.net.my> Received: from 202.188.95.15 (EHLO ipop3.tm.net.my) (202.188.95.15) by + mta153.mail.sc5.yahoo.com with SMTP; Sun, 21 Dec 2003 03:35:58 -0800 Return-path: <chfarn.net.my@tm.net.my> Received: from av6 ([172.21.0.21]) by ipop3.tm.net.my (iPlanet Messagi +ng Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0HQ8009H +GTJXGU@ipop3.tm.net.my> for hweefarn@yahoo.com; Sun, 21 Dec 2003 19:3 +5:57 +0800 (SGT) Received: from hotmail.com ([219.95.188.60]) by ipop1.tm.net.my (iPlan +et Messaging Server 5.1 HotFix 1.6 (built Oct 18 2002)) with ESMTP id + <0HQ80024OTJVEV@ipop1.tm.net.my> for hweefarn@yahoo.com; Sun, 21 Dec + 2003 19:35:57 +0800 (SGT) Date: Sun, 21 Dec 2003 19:35:57 +0800 (SGT) Date: Date header was inserted by ipop1.tm.net.my


****************************************************

do u observe that there are more than 1 "Receive:" ?
i believe that it is inserted automatically by the module like IO::Socket::INET or Net::SMTP. subsequently this cause my service provider think that i am spammers. therefore, they drops my email and not forward to my cell phone.

so, that's why i need to find the solution to send an email without using any of the modules. i found a script writen in php for send socketmail. it is simple and does not use any module or built-in function. i try to run it and it really works. the sms really reach my cell phone successfully. that's why i am so sure that the problem is come from the perl modules.

so, does anyone know any way to send an email without using any modules?

that's all my problems. thank you very much :)

regards,
hweefarn

20031221 Edit by Corion: Added code tags around mail headers

Replies are listed 'Best First'.
Re: how to send email without using any module?
by b10m (Vicar) on Dec 21, 2003 at 12:33 UTC

    I presume you talk about this line:

    Received: from av6 ([172.21.0.21]) by ipop3.tm.net.my (iPlanet Messagi +ng Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0HQ8009H +GTJXGU@ipop3.tm.net.my> for spam+protected@yahoo.com; Sun, 21 Dec 200 +3 19:35:57 +0800 (SGT)

    Don't blame any module, nor the MTA for it, but SMTP ;-)

    This is how the flow goes:
    Your script opens a connection to the MTA. The MTA adds a Received header (since he *did* receive a connection). Then it looks at the address (spam+protected@yahoo.com) and passes it on.

    But it doesn't matter for Yahoo how many hops there are between the first MTA and the last. It only cares about the one that passes it on to the Yahoo mailservers to determine wheter it is spam or not (202.188.95.15 in this case). A simple lookup (have javascript turned on for this) will show you that the IP address is listed by SPEWS (and others). This is most likely why Yahoo will tag it as being spam. Try a non-spamming server and it'll probably work ;-)

    HTH

    Update: For more on SPEWS, see their website. SPEWS is widely adopted and feared by all spammers (read about the cowardly DDoS attacks)

    --
    b10m
Re: how to send email without using any module?
by CombatSquirrel (Hermit) on Dec 21, 2003 at 12:17 UTC
    I am not in any way an Internet guru or the like, but AFAIK, there are multiple Received lines most of the time, because your email is usually routed over more than one server. I wouldn't think that using a Perl module to send your emails could possibly cause this. Furthermore, have you searched CPAN yet for SMS? I remember getting a couple of matches when I tried a couple of months ago, although I haven't tried them.
    Hope this helped.
    CombatSquirrel.
    Entropy is the tendency of everything going to hell.
Re: how to send email without using any module?
by oha (Friar) on Dec 21, 2003 at 12:35 UTC
    As CombatSquirrel states, the Receive: are added by each server your mail "hop" to.

    The reason you could not receive the SMS could be regard of missing other headers, but not a RFC error, maybe a "policy" used by the destination smtp server which would/could not send the sms.

    unfortunately i have no idea.

Re: how to send email without using any module?
by Anonymous Monk on Dec 21, 2003 at 17:00 UTC
    It is not the 'Recieve' lines per se that sould cause maxis.net.my to think that your email is spam, but the apparent 'pass through' problem that the email is coming in, as the recieve lines not from a hotmail.com account for a yahoo.com account. So they might consider that an effort to use their site as a relay. The issue could well be with how you are putting together your code using Net::SMTP - although I would probably use Mail::Mailer. It provides a much nicer interface into Net::SMTP. So one of the first questions was why did you connect to hotmail.com as your smtp server to begin with, rather than attempting to connect directly to ipop3.tm.net.my